/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package server;

/**
 *
 * @author SergioPeres
 */
public class Parametros {
        int port;
        String pathDir;
        
        public Parametros() {
            port = 80;
            pathDir = "www";
        }
        
        public void setParametros(String[] args) {
            if (args.length == 1) {
                try {
                    port = Integer.parseInt(args[0]);
                } catch (java.lang.NumberFormatException e) {
                    pathDir = args[0];
                }
            } else {
                if (args.length == 2) {
                    try {
                        port = Integer.parseInt(args[0]);
                        pathDir = args[1];
                    } catch (java.lang.NumberFormatException e) {
                        pathDir = args[0];
                        port = Integer.parseInt(args[1]);
                    }
                } else {
                    System.out.println("\tErro na passagem de parametros!!!\n"
                            + "\tO servidor utilizara a configuração default.\n "
                            + "\t(dir = \"www\"; port = 80)\n");
                }
            }
        }
        
        public String getPathDir() {
            return pathDir;
        }
        
        public int getPort() {
            return port;
        }
    }
